Release 10.1A: OpenEdge Development:
Progress 4GL Reference


QUERY-PREPARE( ) method

Compiles a predicate (query condition).

Return type: LOGICAL

Applies to: Query object handle

Syntax
QUERY-PREPARE ( predicate-expression ) 

predicate-expression

A CHARACTER expression that evaluates to an OPEN QUERY ... FOR EACH statement without the OPEN QUERY .... You can also use a field phrase.

The QUERY-PREPARE method corresponds to the OPEN QUERY statement’s compilation phase. To open the query object, use the QUERY-OPEN method.

If the QUERY-PREPARE method encounters an error, it returns FALSE and does not raise an error.

If you use the QUERY-PREPARE method in a statement that uses the NO-ERROR option and an error occurs, the QUERY-PREPARE method still returns FALSE and does not raise an error. You can get information on the error through the GET-MESSAGE method of the ERROR-STATUS system handle, as usual.

Note: The QUERY-PREPARE method is compatible with indexed reposition of queries with joins. In predicate-expression, just include the INDEXED-REPOSITION option. For more information on the INDEXED-REPOSITION option, see the reference entry for the OPEN QUERY statement.

The following are examples:

my-query-handle:QUERY-PREPARE("for each customer where cust-num < 9)". 

my-query-handle:QUERY-PREPARE(my-predicate). 

my-query-handle:QUERY-PREPARE("for each customer where cust-num > "
  + string(my-integer)). 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095